# 示例插件 Makefile

# 编译器配置
CC = gcc
CFLAGS = -Wall -Wextra -fPIC -g -O2 -D_GNU_SOURCE
LDFLAGS = -shared -ldl -pthread -lssl -lcrypto
INCLUDE_DIR = ../../include

# 目标和源文件
PLUGIN_NAME = example_plugin.so
SRC = plugin.c
OBJ = $(SRC:.c=.o)
TARGET = ../../build/plugins/$(PLUGIN_NAME)

# 默认目标
all: $(TARGET)

# 编译目标
$(TARGET): $(OBJ)
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) -I$(INCLUDE_DIR) $(LDFLAGS) -o $@ $<
	@echo "已构建示例插件: $@"

# 编译源文件
%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

# 清理目标
clean:
	rm -f $(OBJ) $(TARGET)
	@echo "已清理示例插件"

# 目标是伪目标
.PHONY: all clean
